import React, { Component } from 'react'
import { homelist } from "../api/index"

export default class Tab2 extends Component {
    state = {
        homelist: [],
    }
    componentDidMount() {
        this.getlist();
    }
    getlist = () => {
        homelist().then(res => {
            this.setState({
                homelist: res.data.data,
            })
        })
    }
    render() {
        const { homelist } = this.state;
        return (
            <div className='tab2'>
                {
                    homelist ? homelist.map((item, index) => {
                        return <div className='tabbox' key={index}>
                            <h4>
                                <span>美洽科普</span>
                                <span>{item.time}</span>
                            </h4>
                            <dl>
                                <dt> <img src={item.img} alt='' /></dt>
                                <dd><p>{item.title}</p></dd>
                            </dl>
                        </div>
                    }) : null
                }
            </div>
        )
    }
}
